﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/SiteManage.Master" AutoEventWireup="true" CodeBehind="QuanLiSach.aspx.cs" Inherits="NXBSaiGon.Admin.QuanLiSach" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="text-align:center">
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="MaSach" 
        DataSourceID="SqlDataSource1" 
        EmptyDataText="There are no data records to display." ForeColor="#333333" 
        GridLines="None" Width="910px" PageSize="5">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            
            <asp:HyperLinkField DataNavigateUrlFields="MaSach, MaLoaiSach" 
                DataNavigateUrlFormatString="~/Admin/Sach.aspx?MaSach={0}&amp;MaLoaiSach={1}" 
                DataTextField="TenSach" HeaderText="TenSach" />
            
            <asp:BoundField DataField="NgayXuatBan" HeaderText="NgayXuatBan" 
                SortExpression="NgayXuatBan" />
            <asp:BoundField DataField="SoLuong" HeaderText="SoLuong" 
                SortExpression="SoLuong" />
            <asp:BoundField DataField="DonGia" HeaderText="DonGia" 
                SortExpression="DonGia" />
            <asp:BoundField DataField="NgayNhapKho" HeaderText="NgayNhapKho" 
                SortExpression="NgayNhapKho" />
            
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        </Columns>
        <EditRowStyle BackColor="#7C6F57" />
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#E3EAEB" />
        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F8FAFA" />
        <SortedAscendingHeaderStyle BackColor="#246B61" />
        <SortedDescendingCellStyle BackColor="#D4DFE1" />
        <SortedDescendingHeaderStyle BackColor="#15524A" />
    </asp:GridView>
</div>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NXBSaiGonConnectionString1 %>" 
        DeleteCommand="DELETE FROM [Sach] WHERE [MaSach] = @MaSach" 
        InsertCommand="INSERT INTO [Sach] ([MaLoaiSach], [TenSach], [NgayXuatBan], [MoTa], [SoLuong], [DonGia], [ImageURL], [ChieuCao], [ChieuRong], [BeDay], [KhoiLuong], [NgayNhapKho]) VALUES (@MaLoaiSach, @TenSach, @NgayXuatBan, @MoTa, @SoLuong, @DonGia, @ImageURL, @ChieuCao, @ChieuRong, @BeDay, @KhoiLuong, @NgayNhapKho)" 
        ProviderName="<%$ ConnectionStrings:NXBSaiGonConnectionString1.ProviderName %>" 
        SelectCommand="SELECT [MaSach], [MaLoaiSach], [TenSach], [NgayXuatBan], [MoTa], [SoLuong], [DonGia], [ImageURL], [ChieuCao], [ChieuRong], [BeDay], [KhoiLuong], [NgayNhapKho] FROM [Sach]" 
        UpdateCommand="UPDATE [Sach] SET [MaLoaiSach] = @MaLoaiSach, [TenSach] = @TenSach, [NgayXuatBan] = @NgayXuatBan, [MoTa] = @MoTa, [SoLuong] = @SoLuong, [DonGia] = @DonGia, [ImageURL] = @ImageURL, [ChieuCao] = @ChieuCao, [ChieuRong] = @ChieuRong, [BeDay] = @BeDay, [KhoiLuong] = @KhoiLuong, [NgayNhapKho] = @NgayNhapKho WHERE [MaSach] = @MaSach">
        <DeleteParameters>
            <asp:Parameter Name="MaSach" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="TenSach" Type="String" />
            <asp:Parameter Name="NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="MoTa" Type="String" />
            <asp:Parameter Name="SoLuong" Type="Int32" />
            <asp:Parameter Name="DonGia" Type="Decimal" />
            <asp:Parameter Name="ImageURL" Type="String" />
            <asp:Parameter Name="ChieuCao" Type="Decimal" />
            <asp:Parameter Name="ChieuRong" Type="Decimal" />
            <asp:Parameter Name="BeDay" Type="Decimal" />
            <asp:Parameter Name="KhoiLuong" Type="Decimal" />
            <asp:Parameter Name="NgayNhapKho" Type="DateTime" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="TenSach" Type="String" />
            <asp:Parameter Name="NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="MoTa" Type="String" />
            <asp:Parameter Name="SoLuong" Type="Int32" />
            <asp:Parameter Name="DonGia" Type="Decimal" />
            <asp:Parameter Name="ImageURL" Type="String" />
            <asp:Parameter Name="ChieuCao" Type="Decimal" />
            <asp:Parameter Name="ChieuRong" Type="Decimal" />
            <asp:Parameter Name="BeDay" Type="Decimal" />
            <asp:Parameter Name="KhoiLuong" Type="Decimal" />
            <asp:Parameter Name="NgayNhapKho" Type="DateTime" />
            <asp:Parameter Name="MaSach" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
